/**
 * fileName: ActivityServiceImpl.java
 * fileTime: 2011-6-14上午10:43:56
 */
package com.bf.xpdd.service.impl;

import java.sql.SQLException;
import java.util.List;

import com.bf.xpdd.domain.ActivityBean;
import com.bf.xpdd.domain.SiteSeller;
import com.bf.xpdd.exception.BaseException;
import com.bf.xpdd.persistent.iface.DaoActivity;
import com.bf.xpdd.service.ActivityService;

/**
 * 用户从数据库操作活动信息
 * 
 * @author linmu
 * 
 */
public class ActivityServiceImpl implements ActivityService
{

	/**
	 * 活动对应的DAO层对象,spring容器注入
	 */
	private DaoActivity daoActivity;

	/**
	 * @param daoActivity
	 *            the daoActivity to set
	 */
	public void setDaoActivity(DaoActivity daoActivity)
	{
		this.daoActivity = daoActivity;
	}

	@Override
	public List<ActivityBean> queryAllActivities()
	{
		return this.daoActivity.queryAllActivities();
	}

	@Override
	public List<ActivityBean> queryActivityInfoByNick(String nick)
	{
		return this.daoActivity.queryActivityInfoByNick(nick);
	}
	
	@Override
	public void addActivityBean(ActivityBean bean)
	{
		this.daoActivity.addActivity(bean);
	}

	@Override
	public void delActivityBean(ActivityBean bean)
	{
		delActivityBeanById(bean.getAid());
	}

	@Override
	public void delActivityBeanById(long id)
	{
		this.daoActivity.delActivity(id);
	}

	@Override
	public void modifyActivityBean(ActivityBean bean)
	{
		this.daoActivity.modifyActivity(bean);
	}

	@Override
	public ActivityBean queryActivityBeanById(long id)
	{
		return this.daoActivity.queryActivityInfoById(id);
	}

	@Override
	public List<ActivityBean> queryActivitiesByPage(int pageNum, int pageSize)
	{
		return this.daoActivity.queryActivitiesByPage(pageNum, pageSize);
	}

	@Override
	public List<ActivityBean> queryActivitiesByMonth(SiteSeller seller, int month) throws BaseException
	{
		try
		{
			return this.daoActivity.queryActivitiesByMonth(seller, month);
		}
		catch (SQLException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new BaseException("查询用户有效活动失败");
		}
	}

	@Override
	public List<ActivityBean> queryActivitiesByStatus(String nick, int status)
	{
		return this.daoActivity.queryActivitiesByStatus(nick, status);
	}

	@Override
	public void modifyActivityStatus(int status, long aid, String nick)
	{
		this.daoActivity.modifyActivityStatus(status, aid, nick);
	}

	@Override
	public List<Long> queryAllModelIds(String nick)
	{
		return this.daoActivity.queryAllModelIds(nick);
	}

	@Override
	public List<ActivityBean> queryActivityByModel(long modelId)
	{
		return this.daoActivity.queryActivityByModel(modelId);
	}

	@Override
	public List<ActivityBean> queryActivityLimit(long aid, String nick, int size)
	{
		return this.daoActivity.queryActivityLimit(aid, nick, size);
	}

	@Override
	public void saveActivityDiscount(ActivityBean bean, String json) {
		// TODO Auto-generated method stub
		
	}

}
